package com.fyzk.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.fyzk.bean.ShaiDanInfo;
import com.fyzk.view.ShaidanItemView;

public class ShaidanHallAdapter extends BaseAdapter{
	
	public Context context;
	public ArrayList<ShaiDanInfo> shaidanList;
	
	
	public ShaidanHallAdapter(Context context, ArrayList<ShaiDanInfo> shaidanList ){
		this.context = context;
		this.shaidanList = shaidanList;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return shaidanList.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return shaidanList.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return  arg0;
	}

	@Override
	public View getView(int arg0, View convertView, ViewGroup arg2) {
		ViewHolder holder = null;
		if(convertView == null){
			holder = new ViewHolder();
			convertView = new ShaidanItemView(context);
			holder.itemView = (ShaidanItemView) convertView;
			convertView.setTag(holder);
		}else{
			holder = (ViewHolder) convertView.getTag();
		}
		ShaiDanInfo info = shaidanList.get(arg0);
		holder.itemView.setLotteryName(info.getLotteryType());
		holder.itemView.setShaidanAmount(info.getOneAmount());
		holder.itemView.setShaidanRen(info.getShine_scheme_user());
		holder.itemView.setTiCheng(info.getPercentage());
		holder.itemView.setBeishu(info.getMuti());
		return convertView;
	}

	
	class ViewHolder{
		ShaidanItemView itemView;
	}
}
